import { User } from "../entity/user.entity";

export class UserInfoDto {
    public userId: number;
    public phone: string;
    public username: string;
    public avatar: string;
    public nickname: string;
    public openid: string;
    public roles: string[];

    constructor(user: User) {
        this.userId = user.user_id;
        this.phone = user.user_phone;
        this.username = user.user_name;
        this.avatar = user.user_avatar;
        this.nickname = user.wechat_nickname;
        this.openid = user.wechat_openid;
        this.roles = user.roles.map((role) => role.code);
    }
}

export class UserQueryDto {
    userName?: string;
    userPhone?: string;
}

export class UserPageQueryDto extends UserQueryDto {
    pageSize: number;
    current: number;
}